<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="asserts/css/bootstrap.min.css" th:href="@{/webjars/bootstrap/4.3.1/css/bootstrap.css}" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="asserts/css/dashboard.css" th:href="@{/asserts/css/dashboard.css}" rel="stylesheet">
    <style type="text/css">
        /* Chart.js */

        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }

        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
    </style>
</head>
<body>
<div th:insert="~{index :: topbar}"></div>


<div class="container-fluid">
    <div class="row">
        <!--<div th:replace="index :: #sidebar"></div>-->
        <div th:replace="common/bar :: #sidebar(activeUrl='prolist')"></div>
    </div>
</div>
<form class="form-signin" action="/delete">
    <h2><a class="btn btn-sm btn-success"> </a></h2>
    <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
        <h2>供应商列表
            <a class="btn btn-sm btn-success" th:href="@{/provider/proadd}">供应商添加</a>
        </h2>
        <div class="table-responsive">
            <table class="table table-striped table-sm">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>供应商编码</th>
                    <th>供应商名称</th>
                    <!--<th>供应商详细描述</th>-->
                    <th>供应商联系人</th>
                    <th>联系电话</th>
                    <!--<th>地址</th>-->
                    <!--<th>传真</th>-->
                    <!--<th>创建者</th>-->
                    <th>创建时间</th>
                    <!--<th>更新时间</th>-->
                    <!--<th>更新者</th>-->
                    <th>操作</th>
                    <!--<th>营业执照</th>-->
                    <!--<th>组织机构代码证</th>-->
                </tr>
                </thead>
                <tbody>
                <tr th:each="provider : ${providers}">
                    <td th:text ="${provider.id}"></td>
                    <td th:text ="${provider.proCode}"></td>
                    <td th:text ="${provider.proName}"></td>
                    <!--<td th:text ="${provider.proDesc}"></td>-->
                    <td th:text ="${provider.proContact}"></td>
                    <td th:text ="${provider.proPhone}"></td>
                    <!--<td th:text ="${provider.proAddress}"></td>-->
                    <!--<td th:text ="${provider.proFax}"></td>-->
                    <!--<td th:text ="${provider.createdBy}"></td>-->
                    <td th:text="${#dates.format(provider.creationDate,'yyyy-MM-dd')}"></td>
                    <!--<td th:text="${#dates.format(provider.modifyDate,'yyyy-MM-dd')}"></td>-->
                    <!--<td th:text ="${provider.modifyBy}"></td>-->
                    <!--<td th:text ="${provider.companyLicPicPath}"></td>-->
                    <!--<td th:text ="${provider.orgCodePicPath}"></td>-->
                    <td>

                        <a class="btn btn-sm btn-primary" th:href="@{/provider/modify/}+${provider.id}">修改</a>
                        <!-- <button class="btn btn-sm btn-danger" th:attr="del_provider=@{/provider/delete/} + ${provider.id}" id="delProvider">删除</button>-->
                        <a class="btn btn-sm btn-danger" th:href="@{/provider/delete(id=${provider.id})}">删除</a>

                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </main>
</form>

<script>
    $('#delProvider').click(function () {
        var url = $(this).attr('del_provider');
        $('#deleteProviderForm').attr("action",url);
        $('#deleteProviderForm').submit();
    })
</script>
<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" th:src="@{/asserts/js/jquery-3.2.1.slim.min.js}"></script>
<script type="text/javascript" src="asserts/js/popper.min.js" th:src="@{/asserts/js/popper.min.js}"></script>
<script type="text/javascript" src="asserts/js/bootstrap.min.js" th:src="@{/asserts/js/bootstrap.min.js}"></script>

<!-- Icons -->
<script type="text/javascript" src="asserts/js/feather.min.js" th:src="@{/asserts/js/feather.min.js}"></script>
<script>
    feather.replace()
</script>

<!-- Graphs -->
<script type="text/javascript" src="asserts/js/Chart.min.js" th:src="@{/asserts/js/Chart.min.js}"></script>
<script>
    var ctx = document.getElementById("myChart");
    var myChart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
            datasets: [{
                data: [15339, 21345, 18483, 24003, 23489, 24092, 12034],
                lineTension: 0,
                backgroundColor: 'transparent',
                borderColor: '#007bff',
                borderWidth: 4,
                pointBackgroundColor: '#007bff'
            }]
        },
        options: {
            scales: {
                yAxes: [{
                    ticks: {
                        beginAtZero: false
                    }
                }]
            },
            legend: {
                display: false,
            }
        }
    });
</script>

</body>
</html>